libxc: osdep: convert xc_evtchn_bind_unbound_port()
authorIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxc/xc_evtchn.c
tools/libxc/xc_linux.c
tools/libxc/xc_minios.c
tools/libxc/xc_netbsd.c
tools/libxc/xc_solaris.c
tools/libxc/xenctrlosdep.h

index ff807e8b5a8d7b2f32aed65b24a4d39065d9b537..047b5193318594e2d2085559c8512c84cfb43d76 100644 (file)
@@ -88,6 +88,12 @@ int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port)
     return xce->ops->u.evtchn.notify(xce, xce->ops_handle, port);
 }
 
+evtchn_port_or_error_t
+xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
+{
+    return xce->ops->u.evtchn.bind_unbound_port(xce, xce->ops_handle, domid);
+}
+
 /*
  * Local variables:
  * mode: C
index 4ad545a07dfd40e121c4661582411b9e222b7bc1..0ae64fa26c9929ff1effa39d4c779664ce404c71 100644 (file)
@@ -375,14 +375,15 @@ static int linux_evtchn_notify(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
+static evtchn_port_or_error_t
+linux_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_unbound_port bind;
 
     bind.remote_domain = domid;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
+    return ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
 }
 
 evtchn_port_or_error_t
@@ -439,6 +440,7 @@ static struct xc_osdep_ops linux_evtchn_ops = {
     .u.evtchn = {
         .fd = &linux_evtchn_fd,
         .notify = &linux_evtchn_notify,
+        .bind_unbound_port = &linux_evtchn_bind_unbound_port,
     },
 };
 
index 30c2f3b529ef9f331bd38718f1b7cb895578e1ab..0a04e4517b0ca05bbb4c4ac3f7fb09f29825ec59 100644 (file)
@@ -277,26 +277,27 @@ static void evtchn_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
     wake_up(&event_queue);
 }
 
-evtchn_port_or_error_t xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
+static evtchn_port_or_error_t minios_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
 {
+    int fd = (int)h;
     int ret, i;
     evtchn_port_t port;
 
     assert(get_current() == main_thread);
-    i = port_alloc(xce->fd);
+    i = port_alloc(fd);
     if (i == -1)
        return -1;
 
     printf("xc_evtchn_bind_unbound_port(%d)", domid);
-    ret = evtchn_alloc_unbound(domid, evtchn_handler, (void*)(intptr_t)xce->fd, &port);
+    ret = evtchn_alloc_unbound(domid, evtchn_handler, (void*)(intptr_t)fd, &port);
     printf(" = %d\n", ret);
 
     if (ret < 0) {
        errno = -ret;
        return -1;
     }
-    files[xce->fd].evtchn.ports[i].bound = 1;
-    files[xce->fd].evtchn.ports[i].port = port;
+    files[fd].evtchn.ports[i].bound = 1;
+    files[fd].evtchn.ports[i].port = port;
     unmask_evtchn(port);
     return port;
 }
@@ -404,6 +405,7 @@ static struct xc_osdep_ops minios_evtchn_ops = {
     .u.evtchn = {
         .fd = &minios_evtchn_fd,
         .notify = &minios_evtchn_notify,
+        .bind_unbound_port = &minios_evtchn_bind_unbound_port,
     },
 };
 
index 5341a274427d800300ffebcd3fa855bdc56ca711..6bd72d970e39f3fc7a5436db753b5fa16e345f90 100644 (file)
@@ -225,15 +225,16 @@ static int netbsd_evtchn_notify(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_unbound_port(xc_evtchn * xce, int domid)
+static evtchn_port_or_error_t
+netbsd_evtchn_bind_unbound_port(xc_evtchn * xce, xc_osdep_handle h, int domid)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_unbound_port bind;
     int ret;
 
     bind.remote_domain = domid;
 
-    ret = ioctl(xce->fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
+    ret = ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
     if (ret == 0)
        return bind.port;
     else
@@ -304,6 +305,7 @@ static struct xc_osdep_ops netbsd_evtchn_ops = {
     .u.evtchn = {
          .fd = &netbsd_evtchn_fd,
          .notify = &netbsd_evtchn_notify,
+         .bind_unbound_port = &netbsd_evtchn_bind_unbound_port,
     },
 };
 
index edca1871bede667320ebae39fb12a04d8d351b0f..eaacad5f70a303061d22a5a6c180f9f59ec91358 100644 (file)
@@ -217,14 +217,15 @@ static int solaris_evtchn_notify(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_
     return ioctl(fd, IOCTL_EVTCHN_NOTIFY, &notify);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
+static evtchn_port_or_error_t
+solaris_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_unbound_port bind;
 
     bind.remote_domain = domid;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
+    return ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
 }
 
 evtchn_port_or_error_t
@@ -281,6 +282,7 @@ static struct xc_osdep_ops solaris_evtchn_ops = {
     .u.evtchn = {
         .fd = &solaris_evtchn_fd,
         .notify = &solaris_evtchn_notify,
+        .bind_unbound_port = &solaris_evtchn_bind_unbound_port,
     },
 };
 
index 6bf2d9ccde4e8b3d9b0f9a9e305c27f1951d0863..d67d6d40c67ef28a388aa866f2a70d771a3eb6d6 100644 (file)
@@ -78,6 +78,8 @@ struct xc_osdep_ops
             int (*fd)(xc_evtchn *xce, xc_osdep_handle h);
 
             int (*notify)(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port);
+
+            evtchn_port_or_error_t (*bind_unbound_port)(xc_evtchn *xce, xc_osdep_handle h, int domid);
         } evtchn;
     } u;
 };